#pragma once
#include "DataDef.h"

class Camera
{
public:
	enum CameraType { LANDOBJECT, AIRCRAFT };

	Camera();
	~Camera(void);

	void updateControls();

	void setPosition(FLOAT x, FLOAT y, FLOAT z);

	D3DXMATRIX getViewMatrix();

	D3DXMATRIX getProjMatrix();

	D3DXMATRIX getViewProjMatrix();

	D3DXMATRIX getInvViewProjMatrix();

	D3DXVECTOR3 getPosition3();

	D3DXVECTOR4 getPosition4();

	void resetCamera()
	{
		_pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
		_right = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
		_up = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
		_look = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
	}

	void getViewMatrix(D3DXMATRIX* V);
	void setCameraType(CameraType cameraType);
	void getPosition(D3DXVECTOR3* pos);
	void setPosition(D3DXVECTOR3* pos);
	void getRight(D3DXVECTOR3* right);
	void getUp(D3DXVECTOR3* up);
	void getLook(D3DXVECTOR3* look);

	void strafe(FLOAT units); // left/right
	void fly(FLOAT units); // up/down
	void walk(FLOAT units); // forward/backward
	void pitch(FLOAT angle); // rotate on right vector
	void yaw(FLOAT angle); // rotate on up vector
	void roll(FLOAT angle); // rotate on look vector
private:

	D3DXMATRIX matProj;
	CameraType _cameraType;
	D3DXVECTOR3 _right;
	D3DXVECTOR3 _up;
	D3DXVECTOR3 _look;
	D3DXVECTOR3 _pos;
};
